

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_scap_Device_DateCreated]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[scap_Devices] DROP CONSTRAINT [DF_scap_Device_DateCreated]
END

GO

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_scap_Device_DateModified]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[scap_Devices] DROP CONSTRAINT [DF_scap_Device_DateModified]
END

GO


/****** Object:  Table [dbo].[scap_Devices]    Script Date: 03/03/2013 23:36:20 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[scap_Devices]') AND type in (N'U'))
DROP TABLE [dbo].[scap_Devices]
GO


CREATE TABLE [dbo].[scap_Devices](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[ConnectionType] [tinyint] NULL,
	[IPAddress] [nvarchar](200) NULL,
	[IPPort] [int] NULL,
	[ConnectionStatus] [tinyint] NULL,
	[DateStatusUpdate] [date] NULL,
	[DateCreated] [date] NOT NULL,
	[DateModified] [date] NOT NULL,
 CONSTRAINT [PK_tblDevice] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[scap_Devices] ADD  CONSTRAINT [DF_scap_Device_DateCreated]  DEFAULT (getdate()) FOR [DateCreated]
GO

ALTER TABLE [dbo].[scap_Devices] ADD  CONSTRAINT [DF_scap_Device_DateModified]  DEFAULT (getdate()) FOR [DateModified]
GO


